<%@ page language="java" pageEncoding="UTF-8"%><%@ include file="/pages/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ include file="/pages/common/header.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script type="text/javascript">
    	var CustomersData = "";
        function itemclick(item)
        {
        	$.ligerDialog.open({
                height:600,
                width: 800,
                title : '增加',
                url: './toAddFf.do', 
                showMax: false,
                showToggle: true,
                showMin: false,
                isResize: true,
                slide: false,
                data: {
                    name: $("#maingrid")
                }
            });

        }
        function delclick(item)
        {
        	console.log($("#maingrid"));
        	
        	var data = $("#maingrid").ligerGetGridManager().getCheckedRows();
            if (data.length == 0)
                alert('请选择删除行');
            else
            {
                var ids = [];
                $(data).each(function ()
                {
                    ids.push(this.id);
                });
                ids = ids.join(',');
                
                $.post("./deleteFf?id=" + ids
			            , function (result)
			            {
			        		alert(result);
			        		search();
			            });
            }
            return;
        }
        
        function editclick(id)
        {
        	$.ligerDialog.open({
                height:600,
                width: 800,
                title : '增加',
                url: './toEditFf.do?id=' + id, 
                showMax: false,
                showToggle: true,
                showMin: false,
                isResize: true,
                slide: false,
                data: {
                }
            });
            return;
        }
        
        $(document).ready(function(){
        	search();
        });

        function deleteRow()
        {
            g.deleteSelectedRow();
        }

        var urlStr = "./getFf4Json.do";
        function search() {
        	 window['g'] =
                 $("#maingrid").ligerGrid({
                     height:'100%',
                     checkbox : true,
                     columns: [
                    
					{ display: 'ID', name: 'id', minWidth: 30 },
					{ display: '名称', name: 'bb', minWidth: 30 },
					{ display: '名称s', name: 'code', minWidth: 30 },
					{ display: '描述', name: 'description', minWidth: 30 },
                     
                     { display: '操作', name: 'id',render:function(rowData, rowIndex, value){
         				var html = '<a title="" href="javascript:void(0);" onclick="return editclick(\''+value+'\')">编辑</a>';
         				return html;
         				}
                     }
                     ], 
                     data:CustomersData,  
                     pageSize:30 ,
                     rownumbers:true,
                     url: urlStr,
                     toolbar: { items: [
                     { text: '增加', click: itemclick, icon: 'add' },
                     { line: true },
                     { text: '删除', click: delclick, img: '${pageContext.request.contextPath}/js/ligerUI/skins/icons/delete.gif' }
                     ]
                     }
                 });
                  
        	 //$("#maingrid").ligerGetGridManager().loadData(true);
        	 $("#maingrid").ligerGetGridManager().changePage(true);
             $("#pageloading").hide();
        }
        
        function f_search(){
        	urlStr = "./getUser4Json.do?"
        	search();
        }
      	
    </script>
</head>
<body style="overflow-x:hidden; padding:2px;">
<div class="l-loading" style="display:block" id="pageloading"></div>
<div id="searchbar">
    <input id="btnOK" type="button" value="查询" onclick="f_search()"/>
</div>
 <a class="l-button" style="width:120px;float:left; margin-left:10px; display:none;" onclick="deleteRow()">删除选择的行</a>
 <div class="l-clear"></div>
    <div id="maingrid"></div>
  <div style="display:none;">
</div>
</body>
</html>